package com.huatec.hiot_cloud.core.mqtt.service.impl;

import com.huatec.hiot_cloud.core.dao.IMongoDBBaseDao;
import com.huatec.hiot_cloud.core.mongo_spring.entity.User;
import com.huatec.hiot_cloud.core.mqtt.service.IMongoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ Created by liwenqiang  on 2017/11/28 0028 at 上午 9:31  for mqtt
 * @ Description:
 */
@Service
public class MongoService implements IMongoService {

    @Autowired
    private IMongoDBBaseDao mongoDBBaseDao;

    @Override
    // TODO
    public boolean saveToMongo(String topic, String msg) {
        User user = new User();
        user.setUsername(topic);
        user.setAge(12);
        mongoDBBaseDao.insert(user);
        System.out.println("这里保存设备数据到mongodb");
        return false;
    }
}
